import { seckadd, seckdelete, seckedit, seckinfo, secklist } from "../../utils/request/api.js";
export default {
    secklist_a({ commit }, payload) {
        secklist(payload).then(res => {
            if (res.code == 200 && res.list) {
                 commit('setsecklist',res.list)
            }
        })
    },
    seckadd_a({ commit }, payload) {
        seckadd(payload).then(res => {
             commit('setseckTitle', res)
        })
    },
    seckdelete_a({ commit }, payload) {
        seckdelete(payload).then(res => {
            //把操作成功变成删除成功
            if (res.code == 200) {
                commit('setseckTitle', {...res,msg:"删除成功"})
            }
        })
    },
    seckinfo_a({ commit }, payload) {
        seckinfo(payload).then(res => {
            //点击编辑的时候 直接把id添加到seckinfo上
             commit('setseckinfo',{...res.list,id:payload})
        })
    },
    seckedit_a({ commit }, payload) {
        seckedit(payload).then(res => {
            //把操作成功变成修改成功
            commit('setseckTitle',{...res,msg:"修改成功"})
        })
    },
}